hexdec
Convert hexadecimal to decimal
hexdec()
function converts hexadecimal to decimal.
<?php echo hexdec ( "1e" ) ; echo hexdec ( "a" ) ; echo hexdec ( "11ff" ) ; echo hexdec ( "cceeff" ) ; ?>
Try it yourself
hexdec ( hex_string )
parameter | describe |
---|---|
hex_string | Required. Specifies the hexadecimal number to be converted. |
Returns a decimal number equivalent to the hex number represented by the hex_string parameter. hexdec() converts a hex string to a decimal number. The maximum value that can be converted is 7ffffffff, that is, 2147483647 in decimal. Starting with PHP 4.1.0, this function can handle large numbers, in which case it returns the float type.
hexdec()
replaces all non-hexadecimal characters encountered with 0. This way, all the left zeros are ignored, but the right zeros are counted into the value.